package com.bwie.controller;

import com.bwie.pojo.TbGroupJoin;
import com.bwie.service.TbGroupJoinService;
import com.bwie.utils.R;
import com.bwie.vo.PageInfoVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author 牛毅
 * @version 1.0
 * @date 2025/7/27
 * @description TODO
 */
@RestController
@RequestMapping("/group/groupJoin")
public class GroupJoinController {

    @Autowired
    TbGroupJoinService tbGroupJoinService;

    /** 
     * @description: 商品的分页列表
     * @param: pageInfoVo 
     * @return: com.bwie.utils.R 
     * @author 牛毅
     * @date: 2025/7/27 19:06
     */ 
    @PostMapping("/getGroupJoinList")
    public R getGroupJoinList(@RequestBody PageInfoVo pageInfoVo){
        return tbGroupJoinService.getGroupJoinList(pageInfoVo);
    }
    /**
     * @description: 上传图片
     * @param: file
     * @return: com.bwie.utils.R
     * @author 牛毅
     * @date: 2025/7/27 19:12
     */
    @PostMapping("/uploadFile")
    public R uploadFile(@RequestPart("file")MultipartFile file){
      return   tbGroupJoinService.uploadFile(file);
    }

    /**
     * @description: 添加
     * @param: null
     * @return:
     * @author 牛毅
     * @date: 2025/7/27 19:12
     */
    @PostMapping("/addGroupJoin")
    public R addGroupJoin(@RequestBody TbGroupJoin tbGroupJoin){
        return tbGroupJoinService.addGroupJoin(tbGroupJoin);
    }

    /**
     * @description: 删除
     * @param: null
     * @return:
     * @author 牛毅
     * @date: 2025/7/27 19:27
     */
    @PostMapping("/deleteById/{joinId}")
    public R deleteById(@PathVariable("joinId") Integer joinId){
        return tbGroupJoinService.deleteById(joinId);
    }

    /**
     * @description: 修改
     * @param: null
     * @return:
     * @author 牛毅
     * @date: 2025/7/27 19:12
     */
    @PostMapping("/updateGroupJoin")
    public R updateGroupJoin(@RequestBody TbGroupJoin tbGroupJoin){
        return tbGroupJoinService.updateGroupJoin(tbGroupJoin);
    }
}
